package Thread;

public class ThreadTest {
    public static void main(String[] args) throws InterruptedException {
            Thread t10 = new Thread(() -> {
            System.out.println("01");
        });Thread t9 = new Thread(() -> {
            System.out.println("02");
        });Thread t4 = new Thread(() -> {
            System.out.println("03");
        });Thread t5 = new Thread(() -> {
            System.out.println("04");
        });Thread t6 = new Thread(() -> {
            System.out.println("05");
        });Thread t7 = new Thread(() -> {
            System.out.println("06");
        });Thread t8 = new Thread(() -> {
            System.out.println("07");
        });Thread t3 = new Thread(() -> {
            System.out.println("02");
            t4.start();
            try {
                t4.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });Thread t2 = new Thread(() -> {
            System.out.println("01");
            t3.start();
            try {
                t3.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        Thread t1 = new Thread(() -> {
            System.out.println("0");
            t2.start();
            try {
                t2.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();
        t1.join();
        System.out.println("ok");
    }
}
